package org.product
import org.knowlege.Image
import org.knowlege.Knowlege
class Product {
	static searchable= true
	
	String productCode;
	String productName;
	String productSpec;
	String productDes;
	
	BigDecimal price;
	Integer stockNum;
	String productPackage;
	String unit;
	
	ProductType productType;
	static hasMany =[knowleges:Knowlege,images:Image]
    static constraints = {
    	productCode(blank:false)
    	productName(blank:false)
    	productSpec()
		price()
		stockNum()
		unit()
		productPackage()
    	productDes(widget:'textarea')
		
    }
    
    static mapping = {
    	sort "productCode"
    }
    String toString(){
    	return "${productCode}--${productName}--${productSpec}"
    }
}
